﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Reflection.Emit;

namespace WindowsApplication1
{
    public partial class UseCellInfo : UserControl
    {
        public UseCellInfo()
        {
            InitializeComponent();

        }
        public UInt16 cellnumreal;
        public UInt16 CellNumReal
        {
            get
            {
                //TODO
                return cellnumreal;
            }
            set
            {
                //TODO
                cellnumreal = value;
            }
        }
        public bool cellinfoVisible
        {
            get
            {
                return BMS_CellVolt001.Visible;
            }
            set
            {
                if (value == false)
                {
                    cellnum.Visible = false;
                    labelicon1.Visible = false;
                    labeltemp1.Visible = false;
                    BMS_CellVolt001.Visible = false;
                    BMS_ClusterTemp001.Visible = false;
                    bBALAswitch1.Visible = false;
                    LBALAstate1.Visible = false;
                    label16.Visible = false;
                    label15.Visible = false;
                }
                else
                {
                    cellnum.Visible = true;
                    labelicon1.Visible = true;
                    labeltemp1.Visible = true;
                    BMS_CellVolt001.Visible = true;
                    BMS_ClusterTemp001.Visible = true;
                    bBALAswitch1.Visible = true;
                    LBALAstate1.Visible = true;
                    label16.Visible = true;
                    label15.Visible = true;
                }
            }
        }
       
        public string cellnumtext
        {
            get
            {
                //TODO
                return cellnum.Text;
            }
            set
            {
                //TODO
                cellnum.Text = value;
            }
        }
        public Image VolIcon
        {
            get{

                return labelicon1.Image;
            }
            set { 
                labelicon1.Image = value;
            }
        }
        public Image TempIcon
        {
            get{
                return labeltemp1.Image;
            }
            set{
                labeltemp1.Image = value;
            }
        }      
        public string cellvoltext
        {
            get {
                return BMS_CellVolt001.Text;
            }
            set{
                BMS_CellVolt001.Text = value;
                /*
                if (value == "8.191")
                {
                    cellnum.Visible = false;
                    labelicon1.Visible = false;
                    labeltemp1.Visible = false;
                    BMS_CellVolt001.Visible = false;
                    BMS_ClusterTemp001.Visible = false;
                    bBALAswitch1.Visible = false;
                    LBALAstate1.Visible = false;
                    label16.Visible = false;
                    label15.Visible = false;
                }
                else
                {
                    cellnum.Visible = true;
                    labelicon1.Visible = true;
                    labeltemp1.Visible = true;
                    BMS_CellVolt001.Visible = true;
                    BMS_ClusterTemp001.Visible = true;
                    bBALAswitch1.Visible = true;
                    LBALAstate1.Visible = true;
                    label16.Visible = true;
                    label15.Visible = true;
                }*/
            }
        }
        public string celltemptext
        {
            get{
                return BMS_ClusterTemp001.Text;
            }
            set{
                BMS_ClusterTemp001.Text = value;
            }
        }
        public bool CellBALAEnable
        {
            get
            {
                return bBALAswitch1.Enabled;
            }
            set
            {
                bBALAswitch1.Enabled = value;
            }
        }
        public string cellstatetext
        {
            get{
                return LBALAstate1.Text;
            }
            set{
                LBALAstate1.Text = value;
                if(LBALAstate1.Text == "均衡已开")
                {
                    LBALAstate1.BackColor = Color.Turquoise;
                }
                if (LBALAstate1.Text == "均衡未开")
                {
                    LBALAstate1.BackColor = Color.DarkGray;
                }
            }
        }
        /// <summary>
        /// 鼠标单击事件
        /// </summary>
        public event EventHandler bBALAClick;

        private void bBALAswitch1_Click(object sender, EventArgs e)
        {
            if (this.bBALAClick != null)
            {
                bBALAClick(this, e);
            }
        }
    }
}
